package common.com.androidbase.download;

import android.os.Bundle;
import android.app.Activity;
import android.view.View;
import android.widget.Button;

import com.common.sdk.net.download.DownloadManagerEx;
import com.common.sdk.net.download.DownloadManger;
import com.common.sdk.net.download.interfaces.IDownloadBuilder;
import com.common.sdk.net.download.request.DownloadRequest;
import com.common.sdk.net.download.request.model.DownloadGeneral;
import com.common.sdk.net.download.request.model.DownloadInfo;
import com.sohu.trafficstatistics.model.Condition;
import com.sohu.trafficstatistics.util.TrafficStatisticUtil;

import common.com.androidbase.R;

public class DownloadRequestActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_download_request);
        DownloadManagerEx.init(DownloadRequestActivity.this);
        TrafficStatisticUtil.initialize(DownloadRequestActivity.this);
        Button btn = (Button) findViewById(R.id.send_request);
        Button analyse = (Button) findViewById(R.id.analyse);
        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                IDownloadBuilder downloadRequest = DownloadManagerEx.getInstance();
                DownloadInfo request = new DownloadGeneral(DownloadInfo.DOWNLOAD_SOURCE_OTHER, "http://photocdn.sohu.com/tvmobilemvms/20161206/1763984219148098672918226293_1.jpg",
                        "jpg");
                downloadRequest.deleteAndAddDownloadItem(request);
            }
        });

        analyse.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                TrafficStatisticUtil.analyse(new Condition());
            }
        });

    }

}
